import { reactive } from "vue"

export default function usePagination() {
  const pagination = reactive({
    current: 1,
    pageSize: 10,
    total: 0,
    showTotal: (total: number) => `共 ${total} 条`,
    showQuickJumper: true,
    showSizeChanger: true,
    onChange: (page: number, pageSize: number) => {
      pagination.current = page
      pagination.pageSize = pageSize
    },
    onShowSizeChange: (_current: number, size: number) => {
      pagination.current = 1
      pagination.pageSize = size
    },
  })
  return {pagination}
}
